package com.oraro.paygatewaybiz.channel.wxpay.proxy;

import com.oraro.common.result.Result;
import com.oraro.paygatewaybiz.channel.wxpay.interfaces.WXPayService;
import com.oraro.paygatewaybiz.constant.Constants;
import com.oraro.paygatewaybiz.module.entity.ChannelEntity;
import com.oraro.paygatewaybiz.module.entity.OrderEntity;
import com.oraro.plugin.proxy.OraroServiceProxyPluginManager;
import org.springframework.stereotype.Service;

/**
 * @Author: jianghuiyong
 * @Date: 2018/11/16 11:41
 * @Version 1.0
 */
@Service
public class WXPayServiceProxy extends OraroServiceProxyPluginManager<WXPayService> implements WXPayService {

    @Override
    public String type() {
        return Constants.ProxyType.WXPAYPROXY.getType();
    }

    @Override
    public Result payOrder(OrderEntity orderEntity, ChannelEntity channelEntity) {
        WXPayService wxPayService = selectPlugin(getParam(orderEntity.getTradeType()));
        return wxPayService.payOrder(orderEntity, channelEntity);
    }
}
